package com.biyu.monitormanage.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.biyu.monitormanage.common.utils.PageUtils;
import com.biyu.monitormanage.common.utils.Query;
import com.biyu.monitormanage.dao.PoliceDao;
import com.biyu.monitormanage.entity.PoliceEntity;
import com.biyu.monitormanage.entity.RealTimeDataEntity;
import com.biyu.monitormanage.service.PoliceService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * @author 15491
 */
@Service("policeService")
public class PoliceServiceImpl extends ServiceImpl<PoliceDao, PoliceEntity> implements PoliceService {
    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        String paramKey = (String) params.get("paramKey");
        IPage<PoliceEntity> page = this.page(
                new Query<PoliceEntity>().getPage(params),
                new QueryWrapper<PoliceEntity>()
                        .like(StringUtils.isNoneBlank(paramKey),"param_key", paramKey)
        );

        return new PageUtils(page);
    }
}
